﻿using Avalon.Core.Data;
using Avalon.Core.MVC.Actions;
using Avalon.Core.MVC.Attributes;
using Avalon.Core.MVC.StateBags;

namespace Avalon.Core.MVC.Pipelines {
    [Pipeline("SaveNew", Providers.PipelineType.Post)]
    public class SaveNewPipeline<TModel> : BasePipeline where TModel : class, IEntity, new() {

        public SaveNewPipeline() {
            PipelineActions.Add(new SaveEntityAction<TModel>() { Index = 0 });
        }

        public override void InitializeStateBag() {
            this.StateBag = new EntityBag<TModel>();
        }
    }
}
